﻿<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery基础</title>
<script type="text/javascript" src="jquery-3.5.1.min.js"></script>
</head>
<body>
    
<p id="testp">你好，发哥，要坚强！</p>
<p id="testp2">你好，常威是你弟！</p>
<p id="testp">你好，上格最牛逼！</p>
<p id="testp">你好，发哥，要坚强！</p>
<p id="testp">你好，发哥，要坚强！</p>
<script>
$(document).ready(function(){
    // let $aa=$(`#testp`);//获取指定ID
    let $aa=$(`#testp2`);
    //alert($aa.html());  
})
</script>

<input type="text" id="上格" name="a1">
<input type="button" value="你输入的值为"/>
<script>
$(document).ready(function(){
    $(`input[type='button']`).click(function(){
        let fff=$(`#上格`).val();
        //alert(fff);
    })
})
</script>

<hr>
<input type="text" id="上格2" name="a1">
<input type="button" id="ff1" value="你输入的值为"/>
<script>
$(document).ready(function(){
    $(`#ff1`).click(function(){
        let fff2=$(`#上格2`).val();
        alert(fff2);
    })
})
</script>
</body>
</html>